<!doctype html>
<html lang="en">
<head>
    <link rel="stylesheet" href="${createLinkTo(dir:'css',file:'main.css')}" />
    <link rel="stylesheet" href="${resource(dir:'css/ui/ui-lightness',file:'jquery-ui-1.7.2.custom.css')}" />
    <link rel="stylesheet" href="${resource(dir:'css/autocomplete',file:'jquery.autocomplete.css')}" />
    
	<title>Drawn Your Destiny</title>

    <g:javascript library="jquery"/>
    <g:javascript library="ui/jquery-ui-1.7.2.custom.min"/>
    <g:javascript library="autocomplete/jquery.autocomplete.min"/>
    <g:javascript library="principal"/>

</head>
<body>

    <h1>DRAWN YOUR DESTINY</h1>

    <div class="nav">
        <!-- LOGIN -->
        <g:formRemote id="loginForm" name="loginForm" update="dialogDiv" url="[controller:'autentication',action:'showLogin']">
            <input type="submit" id="loginButton" onclick="submitDialog();" style="display:none"/>
        </g:formRemote>
        
        <!-- LOGOUT -->
		<form method="post"  action="/dyd/autentication/logout" id="logoutForm" name="logoutForm"></form>

        <!-- NOU USUARI -->
        <g:formRemote id="newUserForm" name="newUserForm" update="dialogDiv" url="[controller:'user',action:'create']">
            <input type="submit" id="newUserButton" onclick="submitDialog();" style="display:none"/>
        </g:formRemote>


        <!-- NOU COMIC -->
        <g:formRemote id="newComicForm" name="newComicForm" update="dialogDiv" url="[controller:'comic',action:'create']">
            <input type="submit" id="newComicButton" onclick="submitDialog();" style="display:none"/>
        </g:formRemote>


        <!-- AFEGEIX AGRUPACIO COMICS -->
        <g:formRemote id="newComicGrupForm" name="newComicGrupForm" update="dialogDiv" url="[controller:'collectionComic',action:'create']">
            <input type="submit" id="newComicGrupButton" onclick="submitDialog();" style="display:none"/>
        </g:formRemote>
        
        <!-- MOSTRA LES MEVES DADES -->
        
        <!-- NOVA PAGINA -->
        
        <!-- NOVA PAGINA ALTERNATIVA -->
        
        <!-- MOSTRA USUARIS -->
        <g:formRemote id="listUserForm" name="listUserForm" update="dialogDiv" url="[controller:'user',action:'list']">
            <input type="submit" id="listUserButton" onclick="submitDialog();" style="display:none"/>
        </g:formRemote>
        
        
        
        <!-- MOSTRA PANEL -->
		<g:formRemote id="showComicForm" name="showComicForm" update="panelDiv" url="[controller:'principal',action:'executeFinder']">
			<g:hiddenField name="id" value="1" />		<!-- TODO: que agafi el valor de la consulta -->
            <input type="submit" id="showComicButton" style="display:none"/>
            
            <!-- BUSCADOR -->
	        <input id="finderInput" name="finderInput" type="text" autocomplete="false"/>
	        <g:select id="typeFinderInput" name="typeFinderInput" from="${TiposBusquedaEnum.values()}"/>
        </g:formRemote>



        <!-- BOTONERA -->
        <g:if test="${session.userLogged == null}">
        	<input type="submit"  value="LOGIN" onclick="openLogin();"/>
        	<input type="submit"  value="REGISTRY" onclick="openNewUser();"/>
        </g:if>
        <g:if test="${session.userLogged != null}">
	        <g:if test="${session.userLogged.admin == false}">
	        	<input type="submit"  value="LOGOUT" onclick="logout();"/>
	        	<input type="submit"  value="NEW COMIC" onclick="openNewComic();"/>
	        	<input type="submit"  value="SHOW COMIC" onclick="openShowComic();"/>
	        	<input type="submit"  value="NEW COMIC GRUP" onclick="openNewComicGrup();"/>
	        </g:if>
	        <g:if test="${session.userLogged.admin == true}">
	        	<input type="submit"  value="LOGOUT" onclick="logout();"/>
	        	<input type="submit"  value="NEW COMIC" onclick="openNewComic();"/>
	        	<input type="submit"  value="NEW COMIC GRUP" onclick="openNewComicGrup();"/>
	        	<input type="submit"  value="LIST USERS" onclick="openListUser();"/>
	        </g:if>
        </g:if>
    </div>

    <!-- IMATGE -->
    <div id="contentDiv" align="center">
        <input type="submit"   width="5%" value="PREVIUS" onclick="before();"/>
        <span id="panelDiv">
        	<image src="../uploads/superman/superman_1.jpg" height="500px;" align="center"  onclick="showImatge();"/>
        </span>
        <input type="submit"  width="5%" value="NEXT" onclick="after();"/>
    </div>


    <!-- POP UPS -->
    <div id="dialogDiv"        title="MODAL"               style="display:none"></div>

</body>
</html>